home *** CD-ROM | disk | FTP | other *** search
/ MacFormat España 17 / MacFormat 17 (Spain) / MacFormat 17.bin / Especial Internet / Usenet / Nuntius 2.0.4 / scripts in text format < prev    next >
Encoding:
Text File  |  1995-01-19  |  3.1 KB  |  102 lines

  1. The script stored in "mail script":
  2.  
  3. on ReplyByMail(toText, subjectText, bodyText)
  4.     tell application "Eudora1.5.1Fat"
  5.         activate
  6.         try
  7.             space wasted of (mailbox 1)
  8.         on error e number en
  9.             if en = -1708 then
  10.                 display dialog ¬
  11.                     "It seems like you're using version 1.4 of Eudora. " & ¬
  12.                     "It doesn't support AppleScript well enough, so please " & ¬
  13.                     "upgrade to version 1.4.3 or 1.5 or 2.1." & ¬
  14.                     "" buttons {"OK"} default button "OK"
  15.             else
  16.                 display dialog e & "  (error " & en & ")" buttons {"OK"} default button {"OK"}
  17.             end if
  18.             return
  19.         end try
  20.         try
  21.             -- suggested by Anne Harwell: insert "Re:" in subject
  22.             if subjectText does not start with "Re:" then
  23.                 copy ("Re:" & subjectText) to subjectText
  24.             end if
  25.             copy (make message at end of mailbox "out") to msgRef
  26.             set the field "to" of message msgRef to toText
  27.             set the field "subject" of message msgRef to subjectText
  28.             set the field "" of message msgRef to bodyText
  29.         on error e number en
  30.             display dialog e & "  (error " & en & ")" buttons {"OK"} default button {"OK"}
  31.         end try
  32.     end tell
  33. end ReplyByMail
  34.  
  35.  
  36.  
  37. The script stored in "URL script":
  38.  
  39. on OpenURL(theScheme, theURL)
  40.     -- theScheme contains the scheme not including colon, 
  41.     -- e.g.: "http", "ftp", "mailto", "gopher"
  42.     -- in lowercase
  43.     -- it may too contain the pseudo URL "info-mac"
  44.     
  45.     -- theURL contains the complete URL, e.g.
  46.     -- ftp://ftp.ruc.dk/pub/nuntius/Nuntius1.3b25.sea.hqx
  47.     
  48.     --display dialog ("scheme is '" & theScheme & "' the URL is '" & theURL & "'")
  49.     try
  50.         if (theScheme is "ftp" and ((offset of ".htm" in theURL) is 0)) ¬
  51.             or theScheme is "info-mac" then
  52.             -- Use Anarchie for ftp, except if the file is a .html file
  53.             -- which should be displayed by the www browser.
  54.             -- Note that the some machines stores .html as .htm
  55.             -- (They are so stupid, they even can't discard the last letter of .html)
  56.             --
  57.             -- Anarchie is a bit stupid about short URLs, eg. "ftp://frederik.ruc.dk"
  58.             -- It simply wants to last slash
  59.             copy characters of theURL to theURLCharList
  60.             copy (count theURLCharList) to numChars
  61.             if numChars > 6 and ¬
  62.                 (items 7 thru numChars of theURLCharList) ¬
  63.                     does not contain "/" then
  64.                 copy theURL & "/" to theURL
  65.             end if
  66.             tell application "Anarchie"
  67.                 ignoring application responses
  68.                     -- don't wait for the reply AppleEvent as it
  69.                     -- may take a lot of time
  70.                     -- Anarchie sends the reply event when it
  71.                     -- has fetched all of the file
  72.                     --display dialog theURL
  73.                     geturl theURL
  74.                 end ignoring
  75.             end tell
  76.         else
  77.             tell application "Netscape 1.0N"
  78.                 run
  79.                 -- NetScape sends back the reply event immediately,
  80.                 -- so there is no need for a ignoring statement
  81.                 try
  82.                     GetURL theURL -- 0.93b type event
  83.                     activate
  84.                 on error e number en
  85.                     if en = -1708 then
  86.                         activate
  87.                         activate
  88.                         activate
  89.                         activate
  90.                         activate
  91.                         «event wwwcourl» theURL -- 0.9b type event
  92.                     else
  93.                         display dialog e & "  (error " & en & ")" buttons {"OK"} default button {"OK"}
  94.                     end if
  95.                 end try
  96.             end tell
  97.         end if
  98.     on error e number en
  99.         display dialog e & "  (error " & en & ")" buttons {"OK"} default button {"OK"}
  100.     end try
  101. end OpenURL
  102.